package com.example.multipledatasources.controller;

import com.example.multipledatasources.entity.TestDs1;
import com.example.multipledatasources.entity.TestDs2;
import com.example.multipledatasources.service.TestDs1Service;
import com.example.multipledatasources.service.TestDs2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName TestController
 * @Description TODO
 * @Author hxl
 * @Date 2021/9/8 17:04
 * Version 1.0
 **/
@RestController
public class TestController {

    @Autowired
    TestDs1Service testDs1Service;

    @Autowired
    TestDs2Service testDs2Service;

    @PostMapping("testdb1")
    public String testdb1(){
        TestDs1 info = testDs1Service.getById("1");
        return info.getName2();
    }

    @PostMapping("testdb2")
    public String testdb2(){
        TestDs2 info = testDs2Service.getById("1");
        return info.getName2();
    }

    @PostMapping("testdb1multi")
    public String testdb1multi(){
        String info = testDs1Service.defineSearch(1);
        return info;
    }

    @PostMapping("testdb2multi")
    public String testdb2multi(){
        String info = testDs2Service.defineSearch(1);
        return info;
    }

}
